package com.lans.alg;

/**
 * @author: lans
 * @date: 2025/3/11
 * @name: 刘宇
 */
public class Hanoitower {
    public static void main(String[] args) {
        hanoiTower(3,'A','B','C');
    }

    public static void hanoiTower(int num,char a,char b,char c) {
        if(num==1){
            System.out.println("第"+num+"个盘"+a+"-->"+c);
        }else{
            //如果num多个,需要先从a移动到b
            hanoiTower(num-1,a,c,b);
            System.out.println("第"+num+"个盘"+a+"-->"+c);
            hanoiTower(num-1,b,a,c);
        }
    }
}